#define BOOST_FILESYSTEM_VERSION 3

#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
#  define BOOST_FILESYSTEM_NO_DEPRECATED
#endif
#ifndef BOOST_SYSTEM_NO_DEPRECATED
#  define BOOST_SYSTEM_NO_DEPRECATED
#endif

#include <qtgui>
#include <iostream>
#include <string>
#include "oknosynchronizator.h"
#include <boost/filesystem/operations.hpp>

using namespace std;

OknoSynchronizator::OknoSynchronizator(QWidget *parent) :
		QMainWindow(parent) {
	ui.setupUi(this);
	connect(ui.FromPush, SIGNAL( clicked() ), this, SLOT(fbrowise()));
	connect(ui.Topush, SIGNAL( clicked() ), this, SLOT(tbrowise()));
	connect(ui.Listpush, SIGNAL( clicked() ), this, SLOT(lbrowise()));
}

OknoSynchronizator::~OknoSynchronizator() {
}


void OknoSynchronizator::browise(QComboBox *A) {
	QString directory = QFileDialog::getExistingDirectory(this, QDir::currentPath());
	if (!directory.isEmpty()) {
		if (A->findText(directory) == -1)
			A->addItem(directory);
		A->setCurrentIndex(A->findText(directory));
	}
}

void OknoSynchronizator::fbrowise(){
	browise(ui.FromComboBox);
}
void OknoSynchronizator::tbrowise(){
	browise(ui.ToComboBox);
}
void OknoSynchronizator::lbrowise(){
	browise(ui.ListCombobox);
}
